package com.qcby.onlinelearningplatform.Controller;


import com.qcby.onlinelearningplatform.Common.ResultCommon;
import com.qcby.onlinelearningplatform.Entity.AdminChannel;
import com.qcby.onlinelearningplatform.Service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Slf4j
@Controller
@Api(tags = ("管理员接口"))
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    public AdminService adminService;

    @ResponseBody
    @GetMapping("/channel")
    @ApiOperation("管理员后台栏目界面")
    public ResultCommon adChannel(){
        List<AdminChannel> adChannel =  adminService.adChannel();
        if(adChannel.size() == 0){
            return ResultCommon.error("没有栏目");
        }
        return ResultCommon.success("查询栏目成功",adChannel);
    }


}
